//
//  Request.h
//  缘来
//
//  Created by ZhaoYan on 15/9/26.
//  Copyright (c) 2015年 缘来. All rights reserved.
//  这个工具类中的所有方法都是类方法 直接使用 用于网络请求

#import <Foundation/Foundation.h>
#import "Constants.h"
#import "zhangApi.h"

typedef NS_ENUM(NSUInteger, HttpRequestResult){
    kHttpRequestResultNormal,
    kHttpRequestResultNoMoreData,
    kHttpRequestResultNoValidData,
    kHttpRequestResultError,
    kHttpRequestResultNetworkError = 100,
    kHttpRequestResultUnauthorized = 401,
    kHttpRequestResultFrozen = 4014
};

typedef void (^FinishedBlock)(NSURLSessionDataTask *task, id _Nullable result);
typedef void (^FailureBlock)(NSURLSessionDataTask *task, NSError *error);

@interface NetWork : NSObject

+(NSString *)getAppLanguage;

/**
 *
 *
 *  @param url            完整的网络请求地址(不需要包含"?")
 *  @param params         需要传入的参数   (NSMutableDictionary)
 *  @param httpMethod     请求方式        ("GET" 或者 "POST")
 *  @param finishedBlock  请求成功回调
 *  @param failureBlock  请求失败回调
 *
 */
+ (NSURLSessionDataTask *)requestWithURL:(NSString *)url
                                  params:(NSDictionary *)params
                              httpMethod:(NSString *)httpMethod
                           finishedBlock:(FinishedBlock)finishedBlock
                            failureBlock:(FailureBlock)failureBlock;

//+(NSMutableDictionary *)MutableDictionAry:(NSDictionary *)dictionJson;

@end
